<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>

</body>
<script>
  //变量提升  之对于var类型有效  先声明提升到第一行  后赋值
  //function排在var之后
  function People(name, age) {
    this.name = name,
      this.age = age
  }
  p1 = new People('小明', 13)
  console.log(p1);
  People.prototype.sex = '男'
  People.prototype.say = function () {
    console.log('这是构造函数的原型对象内定义的方法');
  }
  console.log(People.prototype);
  console.log(p1.__proto__);
  console.log(People.prototype === p1.__proto__)//true
  console.log(People.prototype.constructor === p1.__proto__.constructor)//true
  console.log(p1.hasOwnProperty('age'));//true
  console.log(p1.hasOwnProperty('sex'));//false

  console.log(People.prototype.isPrototypeOf(p1));//true
  console.log(Object.prototype.isPrototypeOf(new Date()));//true
</script>

</html>